<%@ page import="com.wuchao.service.serviceImpl.ServiceImpl" %><%--
  Created by IntelliJ IDEA.
  User: Root404
  Date: 2022/6/27
  Time: 9:43
  To change this template use File | Settings | File Templates.
--%>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
    <%
        request.setCharacterEncoding("utf-8");
        String user = request.getParameter("user");
        String pwd = request.getParameter("pwd");
        ServiceImpl service = new ServiceImpl();
        int loading = service.isLoading("select count(1) from user where name=? and sex=?", user, pwd);
        if (loading>0){
            session.setAttribute("user","true");//存值
            session.setAttribute("name",user);
            session.setMaxInactiveInterval(300);//过期时间
         /*   Cookie ck=new Cookie("name",user);//存值
            ck.setMaxAge(45);
            response.addCookie(ck);*/
            request.getRequestDispatcher("s.jsp").forward(request,response);
            //request.getRequestDispatcher("s2.jsp").forward(request,response);
        }else{
            response.sendRedirect("t1.jsp?isload=f&xx=6");
        }
    %>
</body>
</html>
